<template>
    <view class="page-creation-draft">
		<u-sticky>
			<!-- 只能有一个根元素 -->
			<view class="search-sticky">
				<u-search placeholder="请输入关键字" v-model="searchForm.title" :show-action="false" @search="getList('refresh')"></u-search>
			</view>
		</u-sticky>
		<view class="p-4" v-if="longList.list.length == 0">
            <u-empty text="暂无内容" mode="list"></u-empty>
        </view> 
		<view class="fly-card">
            <view class="item" v-for="(item,index) in longList.list" :key="index" @click="gotoPage(item)">
                <view class="content no-border">
                    <view class="title ellipsis-2">{{ item.title || '暂无内容'}}</view>
                    <view class="desc flex-between">
                        <text>{{ item.createTime }}</text>
                        <!-- <u-button class="btn-cyan" shape="circle" size="mini" @click.stop="handleDelete(item)"><u-icon name="trash" color="#fff"></u-icon><text class="ml-1">删除</text></u-button> -->
                    </view>
                </view>
                <view class="thumb">
                    <u-image :src="proxy.$util.getFullImage(item.coverImageUrl)" width="160rpx" height="160rpx"></u-image>
                </view>
            </view>
        </view>
    </view>
</template>
<script setup lang="ts">
import {onShow, onPullDownRefresh, onReachBottom } from '@dcloudio/uni-app';
import { useLonglist } from '@/static/fn/longList';
const initObj = {
	listApi:'/admin/articles/page',
}
let { searchForm, longList, getList} = useLonglist(initObj);
import { useAppStore } from '@/stores/app';
import { useOptionData } from '@/stores/optionData';
const {proxy} = getCurrentInstance() as ComponentInternalInstance;
const appStore = useAppStore();
const optionDataStore = useOptionData();
onPullDownRefresh(() => {
	getList('refresh');
	setTimeout( () => {
		uni.stopPullDownRefresh();
	}, 1000);
});
onReachBottom(() =>{
	getList();
});
onShow(() => {
	getList('refresh');
})
</script>